﻿using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
using Com.queryzer2.Domain.Entities;


namespace Com.AlbLab.CR.Stampe
{
    public enum PdfSelector
    { 
        ORDINE_LAV_1
    }

    public class ORDINE_LAV_1EventArgs : EventArgs
    {
        public ORDINE_LAV_1EventArgs()
        {
            entity = new GEP_TESTATA();
            fase = new GEP_FASE();
        }
        public queryzer2.Domain.Entities.GEP_TESTATA entity;
        public queryzer2.Domain.Entities.GEP_FASE fase;
    }

  
   

    public class PdfBuilder
    {
        public  byte[] getPdf(PdfSelector type, EventArgs e)
        {
            Document pdfDocument = new Document();
            System.IO.MemoryStream output = new MemoryStream();
            
            switch (type)
            { 
                case PdfSelector.ORDINE_LAV_1:
                     PdfWriter.GetInstance(pdfDocument,output).CloseStream=false;
                     stampaOrdine(pdfDocument, (ORDINE_LAV_1EventArgs)e);
                     break;
                default:
                    break;
            }
             pdfDocument.CloseDocument();
            output.Position = 0;
            byte[] outbutb = new byte[output.Length];
                       
           
            output.Read(outbutb, 0, Convert.ToInt32(output.Length));
            
            return outbutb;
           
        }

        private bool DoInsertImageFile(Document document, string sFilename, bool bInsertMsg)
        {
            bool bRet = false;

            try
            {
                if (File.Exists(sFilename) == false)
                {

                }

                iTextSharp.text.Image img = null;
                if (File.Exists(sFilename))
                {
                    this.DoGetImageFile(sFilename, out img);
                }

                if (img != null)
                {
                    document.Add(img);
                    bRet = true;
                }
                else
                {
                    if (bInsertMsg)
                        document.Add(new Paragraph(sFilename + " not found"));
                }
            }
            catch (Exception ex)
            {

            }

            return bRet;
        }

        private iTextSharp.text.Image DoGetImageFile(string sFilename)
        {
            bool bRet = false;
            iTextSharp.text.Image img = null;

            try
            {
                if (File.Exists(sFilename) == false)
                {

                }

                if (File.Exists(sFilename))
                {
                    img = iTextSharp.text.Image.GetInstance(sFilename);
                }

                bRet = (img != null);
            }
            catch (Exception ex)
            {

            }

            return img;
        }

        private bool DoGetImageFile(string sFilename, out iTextSharp.text.Image img)
        {
            bool bRet = false;
            img = null;

            try
            {
                if (File.Exists(sFilename) == false)
                {

                }

                if (File.Exists(sFilename))
                {
                    img = iTextSharp.text.Image.GetInstance(sFilename);
                }

                bRet = (img != null);
            }
            catch (Exception ex)
            {

            }

            return bRet;
        }

        private bool DoLocateImageFile(ref string sFilename)
        {
            bool bRet = false;

            try
            {
                if (File.Exists(sFilename) == false)
                {

                }

            }
            catch (Exception ex)
            {

            }

            return bRet = File.Exists(sFilename);
        }


        private PdfPCell getCell(string value, Font ff,int align,float border)
        {
            PdfPCell c01 = new PdfPCell(new Phrase(value, ff));
            c01.HorizontalAlignment = align;
            c01.BorderWidth = border;
            return c01;
        }

        private bool stampaOrdine(Document document, ORDINE_LAV_1EventArgs e)
        {
            GEP_TESTATA x = e.entity;
            bool bRet = false;
            Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.UNDERLINE | Font.BOLD);
            Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
            Font FBody1 = FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.NORMAL);

            Font FBodySmall = FontFactory.GetFont(FontFactory.HELVETICA, 7, iTextSharp.text.Font.NORMAL);
            Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
            Font FBodyBold1 = FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD);
            try
            {
                document.SetPageSize(PageSize.A4);
                document.Open();

                PdfPTable table0 = new PdfPTable(2);
                int[] width0 = new int[2];
                width0[0] = 50;
                width0[1] = 50;
                
                table0.SetWidths(width0);
                table0.WidthPercentage = 100f;

                PdfPCell c01 = new PdfPCell(new Phrase("ORIDNE DI LAVORO  ____", FBodyBold));
                c01.HorizontalAlignment = 0;
                c01.BorderWidth = 0f;
                table0.AddCell(c01);

                PdfPCell c02 = new PdfPCell(new Phrase("SOPRALLUOGO  ____", FBodyBold));
                c02.HorizontalAlignment = 2;
                c02.BorderWidth = 0f;
                table0.AddCell(c02);

                
                document.Add(table0);
                
                document.Add(new Paragraph("", FBodySmall));
                 Paragraph title = new Paragraph("REPARTO TECNICO - OPERATVO foglio_1 ", FBodySmall);
                title.Alignment = Element.ALIGN_CENTER;
                document.Add(title);
                document.Add(new Paragraph(" ", FBody));
                document.Add(new Paragraph(" ", FBody));
                
                PdfPTable table01 = new PdfPTable(4);
                int[] width01 = new int[4];
                width01[0] = 25;
                width01[1] = 25;
                width01[2] = 25;
                width01[3] = 25;
                table01.SetWidths(width01);
                table01.WidthPercentage = 100f;

                table01.AddCell(getCell("CODICE PRATICA",FBody,0,0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Contatore Consumo", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("DESCRIZIONE RICHIESTA", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Contatore Reattiva", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("CODICE POD", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Contatore Potenza", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("NOME CLIENTE", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));

                table01.AddCell(getCell("C.F. CLIENTE", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Attiva F1", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("P.IVA CLIENTE", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Attiva F2", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("TELEFONO CLIENTE", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Attiva F3", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("INDIRIZZO", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Reattiva F1", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("TIPO CONNESSIONE", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Reattiva F2", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("POT. CONTRATTUALE", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Reattiva F3", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("POT. TOLLERATA", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Potenza F1", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("FASI", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Potenza F2", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("TENSIONE", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Lettura Potenza F3", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell(" ", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));

                table01.AddCell(getCell("TIPO CONN. RICHIESTA", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Contatore Elettronico", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("POT. CONTR. RICHIESTA", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("Data Lettura", FBody, 2, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));

                table01.AddCell(getCell("POT. TOLL. RICHIESTA", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));

                table01.AddCell(getCell("FASI RICHIESTE", FBody, 0, 0.5f));
                 table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));

                table01.AddCell(getCell("TENSIONE RICHIESTA", FBody, 0, 0.5f));
                 table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));

                table01.AddCell(getCell(" ", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));

                table01.AddCell(getCell("Data stimata disponibilità preventivo", FBodySmall, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0.5f));
                table01.AddCell(getCell("", FBody, 0, 0f));
                table01.AddCell(getCell("", FBody, 0, 0f));
               
                document.Add(table01);


                document.NewPage();


                Paragraph title2 = new Paragraph("REPARTO TECNICO - OPERATVO", FBodySmall);
                title2.Alignment = Element.ALIGN_CENTER;
                document.Add(title2);

                Paragraph title21 = new Paragraph("SOPRALLUOGO", FBodyBold);
                title21.Alignment = Element.ALIGN_CENTER;
                document.Add(title21);

                document.Add(new Paragraph(" ", FBody));
                document.Add(new Paragraph(" ", FBody));

                PdfPTable table02 = new PdfPTable(4);
                int[] width02 = new int[4];
                width02[0] = 30;
                width02[1] = 20;
                width02[2] = 20;
                width02[3] = 30;
                table02.SetWidths(width01);
                table02.WidthPercentage = 100f;

                table02.AddCell(getCell("Codice appuntamento", FBodySmall, 0, 0f));
                table02.AddCell(getCell("Data Fissata", FBodySmall, 0, 0f));
                table02.AddCell(getCell("Fascia Oraria", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell(" ", FBody, 0, 0.5f));
                table02.AddCell(getCell(" ", FBody, 0, 0.5f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("Data Arrivo", FBodySmall, 0, 0f));
                table02.AddCell(getCell("Ora Arrivo", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell(" ", FBody, 0, 0.5f));
                table02.AddCell(getCell(" ", FBody, 0, 0.5f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                table02.AddCell(getCell("Causa mancato appuntamento", FBodySmall, 0, 0f));
                table02.AddCell(getCell("[ ] Forza Maggiore", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("[ ] Causa esercente", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("[ ] Causa Cliente", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                table02.AddCell(getCell("TIPO LAVORO", FBodySmall, 0, 0f));
                table02.AddCell(getCell("[ ] Semplice", FBodySmall, 0, 0f));
                table02.AddCell(getCell("[ ] Complesso", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                table02.AddCell(getCell("Fabbricato di n° unità immobiliari", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0.5f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell("Cabina distanza mt.", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0.5f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBodySmall, 0, 0f));

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                PdfPCell c000=getCell("LAVORI A CARICO ASM", FBodySmall, 0, 0f);
                c000.PaddingBottom = 60f;
                table02.AddCell(c000);
                PdfPCell c001 = getCell(" ", FBody, 0, 0.5f);
                
                c001.Colspan = 3;
                table02.AddCell(c001);

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

           
                PdfPCell c002 = getCell("LAVORI A CARICO CLIENTE", FBodySmall, 0, 0f);
                c002.PaddingBottom = 60f;
                table02.AddCell(c002);
                PdfPCell c003 = getCell(" ", FBodySmall, 0, 0.5f);
                c003.Colspan = 3;
                table02.AddCell(c003);

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                PdfPCell c004 = getCell("Concessioni, autorizzazioni, servitù a carico Cliente", FBodySmall, 0, 0f);
                c004.PaddingBottom = 60f;
                table02.AddCell(c004);
                PdfPCell c005 = getCell(" ", FBodySmall, 0, 0.5f);
                c005.Colspan = 3;
                table02.AddCell(c005);

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                table02.AddCell(getCell("Stime ottenimento atti di terzi (GG)", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0.5f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                table02.AddCell(getCell("tempo max esecuzione prestazione (gg)", FBodySmall, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0.5f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));

                PdfPCell cx = getCell(" ", FBody, 0, 0f);
                cx.PaddingBottom = 15f;
                cx.Colspan = 4;
                table02.AddCell(cx);
               

                table02.AddCell(getCell("Data", FBodySmall, 1, 0f));
                table02.AddCell(getCell("Firma sopralluoghista", FBodySmall, 1, 0f));
                table02.AddCell(getCell("Firma tecnico responsabile", FBodySmall, 1, 0f));
                table02.AddCell(getCell("Firma Cliente", FBodySmall, 1, 0f));

                table02.AddCell(getCell(" ", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f));
                table02.AddCell(getCell("", FBody, 0, 0f)); 
                

                table02.AddCell(getCell("______________________", FBodySmall, 1, 0f));
                table02.AddCell(getCell("______________________", FBodySmall, 1, 0f));
                table02.AddCell(getCell("______________________", FBodySmall, 1, 0f));
                table02.AddCell(getCell("______________________", FBodySmall, 1, 0f));


                document.Add(table02);


                document.NewPage();
                

               //////////////////////////////////PAGINA 3//////////////////////////////////

                Paragraph title3 = new Paragraph("REPARTO TECNICO - OPERATVO", FBodySmall);
                title3.Alignment = Element.ALIGN_CENTER;
                document.Add(title3);

                Paragraph title31 = new Paragraph("ESECUZIONE PRESTAZIONE", FBodyBold);
                title31.Alignment = Element.ALIGN_CENTER;
                document.Add(title31);

                document.Add(new Paragraph(" ", FBody));
                document.Add(new Paragraph(" ", FBody));

                PdfPTable table03 = new PdfPTable(4);
                int[] width03 = new int[4];
                width03[0] = 30;
                width03[1] = 20;
                width03[2] = 20;
                width03[3] = 30;
                table03.SetWidths(width01);
                table03.WidthPercentage = 100f;

                table03.AddCell(getCell("Codice appuntamento", FBodySmall, 0, 0f));
                table03.AddCell(getCell("Data Fissata", FBodySmall, 0, 0f));
                table03.AddCell(getCell("Fascia Oraria", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell(" ", FBody, 0, 0.5f));
                table03.AddCell(getCell(" ", FBody, 0, 0.5f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("Data Arrivo", FBodySmall, 0, 0f));
                table03.AddCell(getCell("Ora Arrivo", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell(" ", FBody, 0, 0.5f));
                table03.AddCell(getCell(" ", FBody, 0, 0.5f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell(" ", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));

                table03.AddCell(getCell("Causa mancato appuntamento", FBodySmall, 0, 0f));
                table03.AddCell(getCell("[ ] Forza Maggiore", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("[ ] Causa esercente", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("[ ] Causa Cliente", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell(" ", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));

              

                PdfPCell c0003 = getCell("Motivo mancato appuntamento", FBodySmall, 0, 0f);
                c0003.PaddingBottom = 60f;
                table03.AddCell(c0003);
                PdfPCell c0013 = getCell(" ", FBody, 0, 0.5f);

                c0013.Colspan = 3;
                table03.AddCell(c0013);

                table03.AddCell(getCell(" ", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));

                table03.AddCell(getCell("DATA ESECUZIONE PRESTAZIONE", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0.5f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));

                table03.AddCell(getCell(" ", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));

                table03.AddCell(getCell("Causa mancata prestazione", FBodySmall, 0, 0f));
                table03.AddCell(getCell("[ ] Forza Maggiore", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("[ ] Causa esercente", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("[ ] Causa Cliente", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));
                table03.AddCell(getCell("", FBodySmall, 0, 0f));

                table03.AddCell(getCell(" ", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));

                PdfPCell c0023 = getCell("MOTIVO MANCATA PRESTAZIONE", FBodySmall, 0, 0f);
                c0023.PaddingBottom = 60f;
                table03.AddCell(c0023);
                PdfPCell c0033 = getCell(" ", FBodySmall, 0, 0.5f);
                c0033.Colspan = 3;
                table03.AddCell(c0033);

               
                
                PdfPCell cx3 = getCell(" ", FBody, 0, 0f);
                cx3.PaddingBottom = 15f;
                cx3.Colspan = 4;
                table03.AddCell(cx3);


                table03.AddCell(getCell("Data", FBodySmall, 1, 0f));
                table03.AddCell(getCell("Firma sopralluoghista", FBodySmall, 1, 0f));
                table03.AddCell(getCell("Firma tecnico responsabile", FBodySmall, 1, 0f));
                table03.AddCell(getCell("Firma Cliente", FBodySmall, 1, 0f));

                table03.AddCell(getCell(" ", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));
                table03.AddCell(getCell("", FBody, 0, 0f));


                table03.AddCell(getCell("______________________", FBodySmall, 1, 0f));
                table03.AddCell(getCell("______________________", FBodySmall, 1, 0f));
                table03.AddCell(getCell("______________________", FBodySmall, 1, 0f));
                table03.AddCell(getCell("______________________", FBodySmall, 1, 0f));


                document.Add(table03);

            }
            catch (Exception ex)
            {

            }
            finally
            {
                document.Close();
            }
            return bRet;
        }

        //private bool stampaContenitori(Document document, CompEventArgs e)
        //{
        //    CompostiereEntity x = e.entity;

        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("Domanda di assegnazione in comodato gratuito di contenitori per la raccolta differenziata", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
        //        Paragraph title1 = new Paragraph("Centro Raccolta differenziata " + x.DesImpianto, FBody);
        //        document.Add(title1);
        //        Paragraph sp12 = new Paragraph(" ", FBody);
        //        document.Add(sp12);

        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
               
               
        //        Paragraph l000 = new Paragraph(" ", FBodyBold);
        //        document.Add(l000);
        //        Paragraph l0 = new Paragraph("Generalità del richiedente", FBodyBold);
        //        document.Add(l0);
        //        Paragraph l1 = new Paragraph("Cognome/Nome " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l2 = new Paragraph("Luogo di nascita (comune o stato estero) " + x.LuogoNascita + " Provincia " + x.ProvNascita + " il " + x.DataNascita, FBody);
        //        document.Add(l2);
        //        Paragraph l21 = new Paragraph("Sesso " + x.Sesso + " Codice Fiscale " + x.Cdf, FBody);
        //        document.Add(l21);
        //        Paragraph l22 = new Paragraph("N° Componenti Famiglia e/o coabitanti " + x.ComponentiFamiglia + " Codice Utenza " + e.entity.CodiceTia, FBody);
        //        document.Add(l22);
        //        Paragraph l23 = new Paragraph("Telefono " + x.Telefono + " Cellulare " + x.Cellulare + " email " + x.Email, FBody);
        //        document.Add(l23);
        //        Paragraph l3 = new Paragraph("Residente in " + x.IndirizzoResidenza + " n. " + x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Comune di " + x.LuogoResidenza + " CAP " + x.CapResidenza + " Provincia " + x.ProvResidenza, FBody);
        //        document.Add(l4);
                
        //        Paragraph title11 = new Paragraph("DICHIARA", FTitolo);
        //        title11.SetAlignment("center");
        //        document.Add(title11);
        //        Paragraph sp16 = new Paragraph(" ", FBody);
        //        document.Add(sp16);

        //        //TODO
        //        Paragraph l81 = new Paragraph("[ ] Di Prelevare:", FBody);
        //        document.Add(l81);
        //        if (x.CodRifiuto1 < 200 && x.CodRifiuto1 > 0)
        //        {
        //            Paragraph cc1 = new Paragraph(x.DesRifiuto1 + " Num." + x.SQuantita1, FBody);
        //            cc1.IndentationLeft = 10;
        //            document.Add(cc1);
        //        }
        //        if (x.CodRifiuto2 < 200 && x.CodRifiuto2 > 0)
        //        {
        //            Paragraph cc2 = new Paragraph(x.DesRifiuto2 + " Num." + x.SQuantita2, FBody);
        //            cc2.IndentationLeft = 10;
        //            document.Add(cc2);
        //        }
        //        if (x.CodRifiuto3 < 200 && x.CodRifiuto3 > 0)
        //        {
        //            Paragraph cc3 = new Paragraph(x.DesRifiuto3 + " Num." + x.SQuantita3, FBody);
        //            cc3.IndentationLeft = 10;
        //            document.Add(cc3);
        //        }
        //        Paragraph sp111 = new Paragraph(" ", FBody);
        //        document.Add(sp111);

        //        //TODO

        //        Paragraph l8 = new Paragraph("[ ] Di essere residente nel Comune di Terni nell zono interessate alla raccolta differenziata, porta a porta, domiciliare", FBody);
        //        document.Add(l8);
        //        Paragraph sp14 = new Paragraph(" ", FBody);
        //        document.Add(sp14);

        //        Paragraph title2 = new Paragraph("Si Impegna", FTitolo);
        //        title2.SetAlignment("center");
        //        document.Add(title2);
        //        Paragraph sp21 = new Paragraph(" ", FBody);
        //        document.Add(sp21);

        //        Paragraph l222 = new Paragraph("[ ] ad utilizzare in modo corretto i contenitori;", FBody);
        //        document.Add(l222);
        //        Paragraph l233 = new Paragraph("[ ] a collocare i contenitori secondo le istruzioni ASM di asporto;", FBody);
        //        document.Add(l233);
        //        Paragraph l231 = new Paragraph("[ ] a restituitre i contenitori ad ASM S.p.A., qualora venisse accertato il mancato o non corretto utilizzo dei contenitori;", FBody);
        //        document.Add(l231);
        //        Paragraph sp24 = new Paragraph("[ ] a garantire l'accesso al sito dove verranno ubicati i contenitori al personale incaricato. ", FBody);
        //        document.Add(sp24);
        //        Paragraph sp25 = new Paragraph(" ", FBody);
        //        document.Add(sp25);
        //        Paragraph sp26 = new Paragraph("Il sottoscritto dichiara di aver letto e di approvare le condizioni e le modalità da rispettare per un corretto svolgimento delle attività di compostaggio domestico attraverso il sistema della compostiera.", FBody);
        //        document.Add(sp26);
        //        Paragraph sp251 = new Paragraph(" ", FBody);
        //        document.Add(sp251);
        //        Paragraph sp2813 = new Paragraph(" ", FBody);
        //        document.Add(sp2813);
        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 35; width1[1] = 50; width1[2] = 35;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell(new Phrase("Data " + x.SDataConsegna, FBodyBold));
        //        c.HorizontalAlignment = 1;
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("Firma .......................", FBodyBold));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);

        //        document.Add(table1);

        //        Paragraph sp260 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp260);
        //        Paragraph sp261 = new Paragraph(" ", FBody);
        //        document.Add(sp261);

        //        Paragraph sp27 = new Paragraph("INFORMATIVA", FBodyBold);
        //        document.Add(sp27);
        //        Paragraph sp28 = new Paragraph("Ai sensi dell'art. 13 D.Lgs 193/03 'Codice in materia di prenotazione dei dati personali', l'uffioc ASM responsabile del trattamento dei dati personali raccolti, ed a Lei inerenti, la informa che i dati da Lei forniti saranno utilizzati per elaborazione (cartacea e/o informatica), al fine di poter erogare quanto da Lei richiesto.", FBody);
        //        document.Add(sp28);
        //        Paragraph sp281 = new Paragraph(" ", FBody);
        //        document.Add(sp281);
        //        Paragraph sp2812 = new Paragraph(" ", FBody);
        //        document.Add(sp2812);

        //        PdfPTable table2 = new PdfPTable(3);


        //        table2.SetWidths(width1);
        //        table2.WidthPercentage = 100f;

        //        PdfPCell c11 = new PdfPCell();
        //        c11.HorizontalAlignment = 1;
        //        c11.BorderWidth = 0f;
        //        table2.AddCell(c11);

        //        PdfPCell c12 = new PdfPCell();
        //        c12.BorderWidth = 0f;
        //        table2.AddCell(c12);


        //        PdfPCell c21 = new PdfPCell(new Phrase("Firma .......................", FBodyBold));
        //        c21.HorizontalAlignment = 1;
        //        c21.BorderWidth = 0f;
        //        table2.AddCell(c21);

        //        document.Add(table2);

        //        Paragraph sp2601 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp2601);
        //        Paragraph sp2611 = new Paragraph(" ", FBody);
        //        document.Add(sp2611);

        //        Paragraph sp29 = new Paragraph("Il/La sottoscritto/a è consapevole delle responsabilità e delle sanzioni penali stabilite dalla legge per le false attestazioni e le dichiarazioni mendaci (art. 76 DPR 445/2000)", FBody);
        //        document.Add(sp29);
        //        Paragraph sp30 = new Paragraph("Estremi documento del dichiarante: " + x.TipoDocumento + " N." + x.NumeroDocumento, FBody);
        //        document.Add(sp30);

        //        Paragraph sp25911 = new Paragraph(" ", FBody);
        //        document.Add(sp25911);

        //        PdfPTable table111 = new PdfPTable(3);

        //        table111.SetWidths(width1);
        //        table111.WidthPercentage = 100f;

        //        PdfPCell c111 = new PdfPCell(new Phrase("Firma del dichiarante", FBodyBold));
        //        c111.HorizontalAlignment = 1;
        //        c111.BorderWidth = 0f;
        //        table111.AddCell(c111);

        //        PdfPCell c1222 = new PdfPCell();
        //        c1222.BorderWidth = 0f;
        //        table111.AddCell(c1222);


        //        PdfPCell c2222 = new PdfPCell(new Phrase("Firma dell'operatore", FBodyBold));
        //        c2222.HorizontalAlignment = 1;
        //        c2222.BorderWidth = 0f;
        //        table111.AddCell(c2222);

        //        PdfPCell c41 = new PdfPCell(new Phrase(" "));
        //        c41.BorderWidth = 0f;
        //        table111.AddCell(c41);
        //        PdfPCell c42 = new PdfPCell(new Phrase(" "));
        //        c42.BorderWidth = 0f;
        //        table111.AddCell(c42);
        //        PdfPCell c43 = new PdfPCell(new Phrase(" "));
        //        c43.BorderWidth = 0f;
        //        table111.AddCell(c43);




        //        PdfPCell c3 = new PdfPCell(new Phrase("______________________", FBody));
        //        c3.HorizontalAlignment = 1;
        //        c3.BorderWidth = 0f;

        //        table111.AddCell(c3);

        //        PdfPCell c4 = new PdfPCell();
        //        c4.BorderWidth = 0f;
        //        table111.AddCell(c4);


        //        PdfPCell c5 = new PdfPCell(new Phrase("_______________________", FBody));
        //        c5.HorizontalAlignment = 1;
        //        c5.BorderWidth = 0f;

        //        table111.AddCell(c5);
        //        document.Add(table111);
        //        Paragraph sp252 = new Paragraph(" ", FBody);
        //        document.Add(sp252);
        //        Paragraph sp253 = new Paragraph("Codice operatore " + x.NomeUtente, FBodyBold);
        //        document.Add(sp253);
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampaSacchetti(Document document, CompEventArgs e)
        //{
        //    CompostiereEntity x = e.entity;

        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("Domanda di assegnazione gratuita di sacchetti per la raccolta differenziata", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
        //        Paragraph title1 = new Paragraph("Centro Raccolta differenziata " + x.DesImpianto, FBody);
        //        document.Add(title1);
        //        Paragraph sp12 = new Paragraph(" ", FBody);
        //        document.Add(sp12);

        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));


        //        Paragraph l000 = new Paragraph(" ", FBodyBold);
        //        document.Add(l000);
        //        Paragraph l0 = new Paragraph("Generalità del richiedente", FBodyBold);
        //        document.Add(l0);
        //        Paragraph l1 = new Paragraph("Cognome/Nome " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l2 = new Paragraph("Luogo di nascita (comune o stato estero) " + x.LuogoNascita + " Provincia " + x.ProvNascita + " il " + x.DataNascita, FBody);
        //        document.Add(l2);
        //        Paragraph l21 = new Paragraph("Sesso " + x.Sesso + " Codice Fiscale " + x.Cdf, FBody);
        //        document.Add(l21);
        //        Paragraph l22 = new Paragraph("N° Componenti Famiglia e/o coabitanti " + x.ComponentiFamiglia + " Codice Utenza " + e.entity.CodiceTia, FBody);
        //        document.Add(l22);
        //        Paragraph l23 = new Paragraph("Telefono " + x.Telefono + " Cellulare " + x.Cellulare + " email " + x.Email, FBody);
        //        document.Add(l23);
        //        Paragraph l3 = new Paragraph("Residente in " + x.IndirizzoResidenza + " n. " + x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Comune di " + x.LuogoResidenza + " CAP " + x.CapResidenza + " Provincia " + x.ProvResidenza, FBody);
        //        document.Add(l4);

        //        Paragraph title11 = new Paragraph("DICHIARA", FTitolo);
        //        title11.SetAlignment("center");
        //        document.Add(title11);
        //        Paragraph sp16 = new Paragraph(" ", FBody);
        //        document.Add(sp16);

        //        //TODO
        //        Paragraph l81 = new Paragraph("[ ] Di Prelevare:", FBody);
        //        document.Add(l81);
        //        if (x.CodRifiuto1 >= 200 )
        //        {
        //            Paragraph cc1 = new Paragraph(x.DesRifiuto1 + " Num." + x.SQuantita1, FBody);
        //            cc1.IndentationLeft = 10;
        //            document.Add(cc1);
        //        }
        //        if (x.CodRifiuto2 >= 200)
        //        {
        //            Paragraph cc2 = new Paragraph(x.DesRifiuto2 + " Num." + x.SQuantita2, FBody);
        //            cc2.IndentationLeft = 10;
        //            document.Add(cc2);
        //        }
        //        if (x.CodRifiuto3 >= 200)
        //        {
        //            Paragraph cc3 = new Paragraph(x.DesRifiuto3 + " Num." + x.SQuantita3, FBody);
        //            cc3.IndentationLeft = 10;
        //            document.Add(cc3);
        //        }
        //        Paragraph sp111 = new Paragraph(" ", FBody);
        //        document.Add(sp111);

        //        //TODO

        //        Paragraph l8 = new Paragraph("[ ] Di essere residente nel Comune di Terni nell zono interessate alla raccolta differenziata, porta a porta, domiciliare", FBody);
        //        document.Add(l8);
        //        Paragraph sp14 = new Paragraph(" ", FBody);
        //        document.Add(sp14);

        //        Paragraph sp2813 = new Paragraph(" ", FBody);
        //        document.Add(sp2813);
        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 35; width1[1] = 50; width1[2] = 35;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell(new Phrase("Data " + x.SDataConsegna, FBodyBold));
        //        c.HorizontalAlignment = 1;
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("Firma .......................", FBodyBold));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);

        //        document.Add(table1);

        //        Paragraph sp260 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp260);
        //        Paragraph sp261 = new Paragraph(" ", FBody);
        //        document.Add(sp261);

        //        Paragraph sp27 = new Paragraph("INFORMATIVA", FBodyBold);
        //        document.Add(sp27);
        //        Paragraph sp28 = new Paragraph("Ai sensi dell'art. 13 D.Lgs 193/03 'Codice in materia di prenotazione dei dati personali', l'uffioc ASM responsabile del trattamento dei dati personali raccolti, ed a Lei inerenti, la informa che i dati da Lei forniti saranno utilizzati per elaborazione (cartacea e/o informatica), al fine di poter erogare quanto da Lei richiesto.", FBody);
        //        document.Add(sp28);
        //        Paragraph sp281 = new Paragraph(" ", FBody);
        //        document.Add(sp281);
        //        Paragraph sp2812 = new Paragraph(" ", FBody);
        //        document.Add(sp2812);

        //        PdfPTable table2 = new PdfPTable(3);


        //        table2.SetWidths(width1);
        //        table2.WidthPercentage = 100f;

        //        PdfPCell c11 = new PdfPCell();
        //        c11.HorizontalAlignment = 1;
        //        c11.BorderWidth = 0f;
        //        table2.AddCell(c11);

        //        PdfPCell c12 = new PdfPCell();
        //        c12.BorderWidth = 0f;
        //        table2.AddCell(c12);


        //        PdfPCell c21 = new PdfPCell(new Phrase("Firma .......................", FBodyBold));
        //        c21.HorizontalAlignment = 1;
        //        c21.BorderWidth = 0f;
        //        table2.AddCell(c21);

        //        document.Add(table2);

        //        Paragraph sp2601 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp2601);
        //        Paragraph sp2611 = new Paragraph(" ", FBody);
        //        document.Add(sp2611);

        //        Paragraph sp29 = new Paragraph("Il/La sottoscritto/a è consapevole delle responsabilità e delle sanzioni penali stabilite dalla legge per le false attestazioni e le dichiarazioni mendaci (art. 76 DPR 445/2000)", FBody);
        //        document.Add(sp29);
        //        Paragraph sp30 = new Paragraph("Estremi documento del dichiarante: " + x.TipoDocumento + " N." + x.NumeroDocumento, FBody);
        //        document.Add(sp30);

        //        Paragraph sp25911 = new Paragraph(" ", FBody);
        //        document.Add(sp25911);

        //        PdfPTable table111 = new PdfPTable(3);

        //        table111.SetWidths(width1);
        //        table111.WidthPercentage = 100f;

        //        PdfPCell c111 = new PdfPCell(new Phrase("Firma del dichiarante", FBodyBold));
        //        c111.HorizontalAlignment = 1;
        //        c111.BorderWidth = 0f;
        //        table111.AddCell(c111);

        //        PdfPCell c1222 = new PdfPCell();
        //        c1222.BorderWidth = 0f;
        //        table111.AddCell(c1222);


        //        PdfPCell c2222 = new PdfPCell(new Phrase("Firma dell'operatore", FBodyBold));
        //        c2222.HorizontalAlignment = 1;
        //        c2222.BorderWidth = 0f;
        //        table111.AddCell(c2222);

        //        PdfPCell c41 = new PdfPCell(new Phrase(" "));
        //        c41.BorderWidth = 0f;
        //        table111.AddCell(c41);
        //        PdfPCell c42 = new PdfPCell(new Phrase(" "));
        //        c42.BorderWidth = 0f;
        //        table111.AddCell(c42);
        //        PdfPCell c43 = new PdfPCell(new Phrase(" "));
        //        c43.BorderWidth = 0f;
        //        table111.AddCell(c43);




        //        PdfPCell c3 = new PdfPCell(new Phrase("______________________", FBody));
        //        c3.HorizontalAlignment = 1;
        //        c3.BorderWidth = 0f;

        //        table111.AddCell(c3);

        //        PdfPCell c4 = new PdfPCell();
        //        c4.BorderWidth = 0f;
        //        table111.AddCell(c4);


        //        PdfPCell c5 = new PdfPCell(new Phrase("_______________________", FBody));
        //        c5.HorizontalAlignment = 1;
        //        c5.BorderWidth = 0f;

        //        table111.AddCell(c5);
        //        document.Add(table111);
        //        Paragraph sp252 = new Paragraph(" ", FBody);
        //        document.Add(sp252);
        //        Paragraph sp253 = new Paragraph("Codice operatore " + x.NomeUtente, FBodyBold);
        //        document.Add(sp253);
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}






        //private bool stampa1(Document document, AcqEventArgs e)
        //{
        //    ConfAziendaEntity x = e.entity;
        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.UNDERLINE | Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBody1 = FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.NORMAL);

        //    Font FBodySmall = FontFactory.GetFont(FontFactory.HELVETICA, 7, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    Font FBodyBold1 = FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();



        //        Paragraph title = new Paragraph("Centro Raccolta differenziata " + x.DesImpianto + " di " + x.ComuneImpianto , FBody);
        //        document.Add(title);
        //        Paragraph sp00 = new Paragraph(" ", FBody);
        //        document.Add(sp00);
        //        Paragraph title1 = new Paragraph("Dichiarazione Sostitutiva", FBody1);
        //        title1.Alignment = Element.ALIGN_CENTER;
        //        document.Add(title1);
        //        Paragraph title2 = new Paragraph("DELL'ATTO DI NOTORIETA'", FTitolo);
        //        title2.Alignment = Element.ALIGN_CENTER;
        //        document.Add(title2);
        //        Paragraph sp0 = new Paragraph(" ", FBodySmall);
        //        document.Add(sp0);
        //        Paragraph title3 = new Paragraph("(Art.47 - D.P.R. 28 Dicembre 2000, n. 445)", FBodySmall);
        //        title3.Alignment = Element.ALIGN_CENTER;
        //        document.Add(title3);
        //        Paragraph sp1 = new Paragraph(" ", FBody);
        //        document.Add(sp1);
        //        Paragraph sp2 = new Paragraph(" ", FBody);
        //        document.Add(sp2);
        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
        //        document.Add(new Paragraph(" "));
        //        Paragraph r1 = new Paragraph("Il Sottoscritto " + x.Nome +" " + x.Cognome, FBody);
        //        r1.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r1);
        //        Paragraph r2 = new Paragraph("Nato a " + x.LuogoNascita +" il " + x.DataNascita, FBody);
        //        r2.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r2);
        //        Paragraph r3 = new Paragraph("Residente a "+ x.LuogoResidenza +" in " + x.IndirizzoResidenza + " n."+ x.NumeroCivicoResidenza+x.EsponenteResidenza, FBody);
        //        r3.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r3);
        //        Paragraph sp31 = new Paragraph(" ", FBody);
        //        document.Add(sp31);
        //        Paragraph r4 = new Paragraph("Consapevole che chiunque rilascia dichiarazioni mendaci è puntino ai sensi del codice penale e delle leggi speciali in materia, ai sensi e per gli effetti dell'art. 76 D.P.R. n.445/2000", FBody);
        //        r4.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r4);
        //        Paragraph sp3 = new Paragraph(" ", FBody);
        //        document.Add(sp3);

        //        Paragraph r5 = new Paragraph("DICHIARA", FBodyBold1);
        //        r5.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r5);
        //        Paragraph sp4 = new Paragraph(" ", FBody);
        //        document.Add(sp4);

        //        Paragraph r6 = new Paragraph("[ ] Che i rifiuti conferiti derivano da locali destinati alla propria abitazione", FBodyBold);
        //        r6.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r6);

        //        Paragraph r7 = new Paragraph("[ ] Che i rifiuti conferiti sono quelli derivanti esclusivamente dalle prestazioni effettuate nell'ambito delle attività di cui il dichiarante risulta titolare*", FBodyBold);
        //        r7.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r7);

        //        Paragraph sp5 = new Paragraph(" ", FBody);
        //        document.Add(sp5);

        //        Paragraph r8 = new Paragraph("Esente da imposta di bollo ai sensidell'art. 37 D.P.R. 28 Dicembre 2000, n.455", FBodySmall);
        //        r8.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r8);
        //        Paragraph r9 = new Paragraph("Il conferimento in discarica è gratuito", FBodySmall);
        //        r9.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r9);
        //        Paragraph sp6 = new Paragraph(" ", FBody);
        //        document.Add(sp6);
        //        Paragraph sp7 = new Paragraph(" ", FBody);
        //        document.Add(sp7);

        //        Paragraph sp8 = new Paragraph(" ", FBody);
        //        document.Add(sp8);

        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 30; width1[1] = 20; width1[2] = 50;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell(new Phrase("__________________", FBody));
        //        c.HorizontalAlignment = 1;
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("____________________________________", FBody));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);

        //        PdfPCell c3 = new PdfPCell(new Phrase("Data", FBodySmall));
        //        c3.HorizontalAlignment = 1;
        //        c3.BorderWidth = 0f;

        //        table1.AddCell(c3);

        //        PdfPCell c4 = new PdfPCell();
        //        c4.BorderWidth = 0f;
        //        table1.AddCell(c4);


        //        PdfPCell c5 = new PdfPCell(new Phrase(" Firma del dichiarante (Per esteso e leggibile)**", FBodySmall));
        //        c5.HorizontalAlignment = 1;
        //        c5.BorderWidth = 0f;

        //        table1.AddCell(c5);
        //        document.Add(table1);

        //        Paragraph sp9 = new Paragraph(" ", FBody);
        //        document.Add(sp9);
        //        Paragraph r10 = new Paragraph("______________________________________________________________________________________________", FBody);
        //        r10.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r10);
        //        Paragraph r11 = new Paragraph("* Riferimento al FIR n.......................del.................", FBodySmall);
        //        document.Add(r11);
        //        Paragraph r12 = new Paragraph("**La Firma non va autenticata ne deve necessariamente avvenire in presenza dell'impiegatodell'Ente che ha richiesto il certificato", FBodySmall);
        //        document.Add(r12);

        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampa2(Document document, AcqEventArgs e)
        //{
        //    ConfAziendaEntity x = e.entity;
        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("Attestazione di Conferimento", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
        //        Paragraph sp12 = new Paragraph(" ", FBody);
        //        document.Add(sp12);

        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
        //        document.Add(new Paragraph(" "));
        //        Paragraph l1 = new Paragraph("Il/La Sign " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l2 = new Paragraph("Nato a " + x.LuogoNascita +" Prov. "+ x.ProvNascita +" il "+ x.DataNascita, FBody);
        //        document.Add(l2);
        //        Paragraph l3 = new Paragraph("Residente in "+ x.LuogoResidenza +" Strada/Piazza "+ x.IndirizzoResidenza +" n. "+ x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Documento di identià "+ x.TipoDocumento +" n. "+ x.NumeroDocumento, FBody);
        //        document.Add(l4);
        //        Paragraph l5 = new Paragraph("Codice Fiscale "+ x.Cdf , FBody);
        //        document.Add(l5);
        //        Paragraph l6 = new Paragraph("In data " + x.SDataConferimento, FBody);
        //        document.Add(l6);
        //        Paragraph sp13 = new Paragraph(" ", FBody);
        //        document.Add(sp13);

        //        Paragraph title1 = new Paragraph("Ha Conferito:", FTitolo);
        //        title1.SetAlignment("center");
        //        document.Add(title1);
        //        Paragraph sp16 = new Paragraph(" ", FBody);
        //        document.Add(sp16);
        //        Paragraph l8 = null;
        //        if (x.TipoPratica == 2)
        //            l8 = new Paragraph("Presso il CERD " + x.DesImpianto + " di " + x.ComuneImpianto, FBody);
        //        else
        //            l8 = new Paragraph("Tramite raccolta domiciliare");
        //            document.Add(l8);

        //        Paragraph sp14 = new Paragraph(" ", FBody);
        //        document.Add(sp14);
        //        Paragraph sp15 = new Paragraph(" ", FBody);
        //        document.Add(sp15);

        //        PdfPTable table = new PdfPTable(2);
        //        int[] width = new int[2];
        //        width[0] = 20; width[1] = 80;
        //        table.SetWidths(width);
        //        table.WidthPercentage = 100f;
        //        table.AddCell(new Phrase("Quantità", FBodyBold));
        //        table.AddCell(new Phrase("Descrizione dell'oggetto consegnato", FBodyBold));
        //        if(x.TipoPratica==2 || x.TipoPratica==3)
        //        {
        //        table.AddCell(new Phrase(x.UnitaMisura + " " + x.SQuantita, FBody));
        //        if (x.DescrizioneRifiuto != null && x.DescrizioneRifiuto.Length > 0)
        //            table.AddCell(new Phrase(x.DesRifiuto + " - " + x.DescrizioneRifiuto, FBody));
        //        else
        //            table.AddCell(new Phrase(x.DesRifiuto, FBody));
        //        if (x.DesRifiuto1.Trim().Length==0)
        //        {
        //            table.AddCell(" ");
        //            table.AddCell(" ");
        //        }
        //        else
        //        {
        //            table.AddCell(new Phrase(x.UnitaMisura1 + " " + x.SQuantita1, FBody));
        //            if (x.DescrizioneRifiuto1 != null && x.DescrizioneRifiuto1.Length > 0)
        //                table.AddCell(new Phrase(x.DesRifiuto1 + " - " + x.DescrizioneRifiuto1, FBody));
        //            else
        //                table.AddCell(new Phrase(x.DesRifiuto1, FBody));
        //        }

        //        if (x.DesRifiuto2.Trim().Length==0)
        //        {
        //            table.AddCell(" ");
        //            table.AddCell(" ");
        //        }
        //        else
        //        {
        //            table.AddCell(new Phrase(x.UnitaMisura2 + " " + x.SQuantita2, FBody));
        //            if (x.DescrizioneRifiuto2 != null && x.DescrizioneRifiuto2.Length > 0)
        //                table.AddCell(new Phrase(x.DesRifiuto2 + " - " + x.DescrizioneRifiuto2, FBody));
        //            else
        //                table.AddCell(new Phrase(x.DesRifiuto2, FBody));
        //        }

        //        if (x.DesRifiuto3.Trim().Length == 0)
        //        {
        //            table.AddCell(" ");
        //            table.AddCell(" ");
        //        }
        //        else
        //        {
        //            table.AddCell(new Phrase(x.UnitaMisura3 + " " + x.SQuantita3, FBody));
        //            if (x.DescrizioneRifiuto3 != null && x.DescrizioneRifiuto3.Length > 0)
        //                table.AddCell(new Phrase(x.DesRifiuto3 + " - " + x.DescrizioneRifiuto3, FBody));
        //            else
        //                table.AddCell(new Phrase(x.DesRifiuto3, FBody));
        //        }

        //        }
        //        else
        //        {
        //            if(x.DomFascine.HasValue &&x.DomFascine>0)
        //            {
        //                  table.AddCell(new Phrase("N. " + x.DomFascine, FBody));
        //                  table.AddCell(new Phrase("SFALCI - FASCINE", FBody));
        //            }
        //            if(x.DomSacchi.HasValue &&x.DomSacchi>0)
        //            {
        //                 table.AddCell(new Phrase("N. " + x.DomSacchi, FBody));
        //                  table.AddCell(new Phrase("SFALCI - SACCHI", FBody));
        //            }
        //            if(x.DomAltro!=null &&x.DomAltro.Length>0)
        //            {
        //             table.AddCell(new Phrase(" "));
        //             table.AddCell(new Phrase(x.DomAltro, FBody));
        //            }

        //        }


        //        document.Add(table);

        //        document.Add(new Paragraph(" "));
        //        document.Add(new Paragraph(" "));

        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 35; width1[1] = 50; width1[2] = 35;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell(new Phrase("L'utente", FBodyBold));
        //        c.HorizontalAlignment = 1;
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("ASM Terni Spa", FBodyBold));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);

        //        PdfPCell c41 = new PdfPCell(new Phrase(" "));
        //        c41.BorderWidth = 0f;
        //        table1.AddCell(c41);
        //        PdfPCell c42 = new PdfPCell(new Phrase(" "));
        //        c42.BorderWidth = 0f;
        //        table1.AddCell(c42);
        //        PdfPCell c43 = new PdfPCell(new Phrase(" "));
        //        c43.BorderWidth = 0f;
        //        table1.AddCell(c43);




        //        PdfPCell c3 = new PdfPCell(new Phrase("______________________", FBody));
        //        c3.HorizontalAlignment = 1;
        //        c3.BorderWidth = 0f;

        //        table1.AddCell(c3);

        //        PdfPCell c4 = new PdfPCell();
        //        c4.BorderWidth = 0f;
        //        table1.AddCell(c4);


        //        PdfPCell c5 = new PdfPCell(new Phrase("_______________________", FBody));
        //        c5.HorizontalAlignment = 1;
        //        c5.BorderWidth = 0f;

        //        table1.AddCell(c5);

        //        document.Add(table1);
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampa3(Document document, AcqEventArgs e)
        //{
        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        //intestazione
        //        PdfPTable table1 = new PdfPTable(4);
        //        int[] width1 = new int[4];
        //        width1[0] = 20;
        //        width1[1] = 50;
        //        width1[2] = 22;
        //        width1[3] = 8;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //        }

        //        PdfPCell c = new PdfPCell(jpg);
        //        c.Padding = 2;
        //        c.Rowspan = 3;

        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell(new Phrase("MODALITA' DI GESTIONE DEI  CENTRI DI RACCOLTA DIFFERENZIATA (CERD) DI ASM TERNI Spa"));
        //        c1.HorizontalAlignment = 1;
        //        c1.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        c1.Rowspan = 3;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("PO SIA 09 17"));
        //        c2.HorizontalAlignment = 1;
        //        c2.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        c2.FixedHeight = 40f;
        //        c2.Rowspan = 2;
        //        table1.AddCell(c2);

        //        PdfPCell c3 = new PdfPCell(new Phrase("rev.1"));
        //        c3.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        c3.HorizontalAlignment = 1;
        //        c3.Rowspan = 2;
        //        table1.AddCell(c3);

        //        PdfPCell c10 = new PdfPCell(new Phrase("Pagina 13/25"));
        //        c10.Colspan = 2;
        //        c10.HorizontalAlignment = 1;
        //        c10.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        table1.AddCell(c10);

        //        document.Add(table1);


        //        //fine intestazione
        //        Paragraph sp1 = new Paragraph(" ", FBody);
        //        document.Add(sp1);
        //        Paragraph r1 = new Paragraph("All.4", FBody);
        //        document.Add(new Paragraph("Scheda N. " + e.entity.Id, FBodyBold));
        //        document.Add(new Paragraph(" "));
        //        document.Add(r1);
        //        Paragraph r2 = new Paragraph("SCHEDA RIFIUTI CONFERITI AL CENTRO RACCOLTA", FBody);
        //        r2.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r2);
        //        Paragraph r3 = new Paragraph("(per utenze non domestiche)", FBody);
        //        r3.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r3);
        //        Paragraph sp3 = new Paragraph(" ", FBody);
        //        document.Add(sp3);
        //        //tabella conferimento
        //        PdfPTable table2 = new PdfPTable(3);
        //        int[] width2 = new int[3];
        //        width2[0] = 30;
        //        width2[1] = 20;
        //        width2[2] = 50;

        //        table2.SetWidths(width2);
        //        table2.WidthPercentage = 80f;

        //        PdfPCell cc1 = new PdfPCell(new Phrase(" "));
        //        cc1.Rowspan = 2;
        //        table2.AddCell(cc1);

        //        PdfPCell cc2 = new PdfPCell(new Phrase("Numero", FBody));
        //        cc2.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc2);

        //        PdfPCell cc3 = new PdfPCell(new Phrase(e.entity.Id.ToString(), FBody));//NUMERO
        //        cc3.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc3);

        //        PdfPCell cc4 = new PdfPCell(new Phrase("Data", FBody));
        //        cc4.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc4);

        //        PdfPCell cc5 = new PdfPCell(new Phrase(e.entity.DataConferimento.ToString("dd/MM/yyyy"), FBody));//DATA
        //        cc5.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc5);

        //        PdfPCell cc6 = new PdfPCell(new Phrase("Centro di Raccolta", FBody));
        //        table2.AddCell(cc6);
        //        PdfPCell cc7 = new PdfPCell(new Phrase(e.entity.DesImpianto, FBody));
        //        cc7.Colspan = 2;
        //        table2.AddCell(cc7);

        //        PdfPCell cc61 = new PdfPCell(new Phrase("Sito in", FBody));
        //        table2.AddCell(cc61);
        //        PdfPCell cc71 = new PdfPCell(new Phrase(e.entity.ComuneImpianto, FBody));//SITOIN
        //        cc71.Colspan = 2;
        //        table2.AddCell(cc71);

        //        PdfPCell cc62 = new PdfPCell(new Phrase("Via e Numero Civico", FBody));
        //        table2.AddCell(cc62);
        //        PdfPCell cc72 = new PdfPCell(new Phrase(e.entity.IndirizzoImpianto, FBody));//STRADA
        //        cc72.Colspan = 2;
        //        table2.AddCell(cc72);

        //        PdfPCell cc63 = new PdfPCell(new Phrase("CAP", FBody));
        //        table2.AddCell(cc63);
        //        PdfPCell cc73 = new PdfPCell(new Phrase(e.entity.CapImpianto, FBody));//CAP
        //        cc73.Colspan = 2;
        //        table2.AddCell(cc73);

        //        PdfPCell cc64 = new PdfPCell(new Phrase("Telefono", FBody));
        //        table2.AddCell(cc64);
        //        PdfPCell cc74 = new PdfPCell(new Phrase(e.entity.TelefonoImpianto, FBody));//TELEFONO
        //        cc74.Colspan = 2;
        //        table2.AddCell(cc74);

        //        PdfPCell cc65 = new PdfPCell(new Phrase("Fax", FBody));
        //        table2.AddCell(cc65);
        //        PdfPCell cc75 = new PdfPCell(new Phrase(e.entity.FaxImpianto, FBody));//FAX
        //        cc75.Colspan = 2;
        //        table2.AddCell(cc75);

        //        PdfPCell cc66 = new PdfPCell(new Phrase("Codice Convenzione", FBody));
        //        table2.AddCell(cc66);
        //        PdfPCell cc76 = new PdfPCell(new Phrase(e.entity.CodiceCOnvenzione, FBody));
        //        cc76.Colspan = 2;
        //        table2.AddCell(cc76);

        //        document.Add(table2);


        //        Paragraph sp5 = new Paragraph(" ", FBody);
        //        document.Add(sp5);

        //        Paragraph r4 = new Paragraph("Descrizione Tipologia di Rifiuto: " + e.entity.DesRifiuto, FBody);
        //        document.Add(r4);
        //        Paragraph r5 = new Paragraph("Codice dell'elenco Rifiuti: " + e.entity.CodRifiuto , FBody);
        //        document.Add(r5);
        //        Paragraph sp6 = new Paragraph(" ", FBody);
        //        document.Add(sp6);


        //        Paragraph r6 = new Paragraph("Azienda:" + e.entity.RagioneSociale, FBody);
        //        r6.IndentationLeft = 30f;
        //        document.Add(r6);
        //        Paragraph r7 = new Paragraph("Partita IVA:"+ e.entity.Piva, FBody);
        //        r7.IndentationLeft = 30f;
        //        document.Add(r7);
        //        Paragraph r8 = new Paragraph("Targa del mezzo che conferisce: "+ e.entity.Targa, FBody);
        //        r8.IndentationLeft = 30f;
        //        document.Add(r8);

        //        Paragraph sp7 = new Paragraph(" ", FBody);
        //        document.Add(sp7);

        //        Paragraph r9 = new Paragraph("Quantitativo conferito al Centro Raccolta "+e.entity.SQuantita.ToString() +" Unità di misura " + e.entity.UnitaMisura , FBody);
        //        document.Add(r9);
        //        Paragraph sp8 = new Paragraph(" ", FBody);
        //        document.Add(sp8);
        //        Paragraph sp10 = new Paragraph(" ", FBody);
        //        document.Add(sp10);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
        //        Paragraph r10 = new Paragraph("Firma dell'Addetto al Centro Raccolta", FBody);
        //        r10.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r10);
        //        Paragraph sp9 = new Paragraph(" ", FBody);
        //        document.Add(sp9);


        //        Paragraph r11 = new Paragraph("______________________________________________", FBody);
        //        r11.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r11);

        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
               
        //    }
        //    return bRet;
        //}

        //private bool stampa4(Document document, SpeEventArgs e)
        //{
        //    AvvioRecuperoEntity x = e.entity;
           
        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        //intestazione
        //        PdfPTable table1 = new PdfPTable(4);
        //        int[] width1 = new int[4];
        //        width1[0] = 20;
        //        width1[1] = 50;
        //        width1[2] = 22;
        //        width1[3] = 8;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //        }

        //        PdfPCell c = new PdfPCell(jpg);
        //        c.Padding = 2;
        //        c.Rowspan = 3;

        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell(new Phrase("MODALITA' DI GESTIONE DEI  CENTRI DI RACCOLTA DIFFERENZIATA (CERD) DI ASM TERNI Spa"));
        //        c1.HorizontalAlignment = 1;
        //        c1.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        c1.Rowspan = 3;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("PO SIA 09 17"));
        //        c2.HorizontalAlignment = 1;
        //        c2.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        c2.FixedHeight = 40f;
        //        c2.Rowspan = 2;
        //        table1.AddCell(c2);

        //        PdfPCell c3 = new PdfPCell(new Phrase("rev.1"));
        //        c3.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        c3.HorizontalAlignment = 1;
        //        c3.Rowspan = 2;
        //        table1.AddCell(c3);

        //        PdfPCell c10 = new PdfPCell(new Phrase("Pagina 14/25"));
        //        c10.Colspan = 2;
        //        c10.HorizontalAlignment = 1;
        //        c10.VerticalAlignment = Element.ALIGN_MIDDLE;
        //        table1.AddCell(c10);




        //        document.Add(table1);


        //        //fine intestazione
        //        Paragraph sp1 = new Paragraph(" ", FBody);
        //        Paragraph sp2 = new Paragraph(" ", FBody);
        //        document.Add(sp1);
        //        Paragraph r1 = new Paragraph("All.5", FBody);
        //        document.Add(r1);
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
        //        document.Add(new Paragraph(" "));
        //        Paragraph r2 = new Paragraph("SCHEDA RIFIUTI AVVIATI AL RECUPERO/SMALTIMENTO", FBody);
        //        r2.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r2);
        //        Paragraph r3 = new Paragraph("DEL CENTRO RACCOLTA", FBody);
        //        r3.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r3);
        //        Paragraph sp3 = new Paragraph(" ", FBody);
        //        document.Add(sp3);
        //        //tabella conferimento
        //        PdfPTable table2 = new PdfPTable(3);
        //        int[] width2 = new int[3];
        //        width2[0] = 30;
        //        width2[1] = 20;
        //        width2[2] = 50;

        //        table2.SetWidths(width2);
        //        table2.WidthPercentage = 80f;

        //        PdfPCell cc1 = new PdfPCell(new Phrase(" "));
        //        cc1.Rowspan = 2;
        //        table2.AddCell(cc1);

        //        PdfPCell cc2 = new PdfPCell(new Phrase("Numero", FBody));
        //        cc2.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc2);

        //        PdfPCell cc3 = new PdfPCell(new Phrase(x.Id.ToString(), FBody));
        //        cc3.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc3);

        //        PdfPCell cc4 = new PdfPCell(new Phrase("Data", FBody));
        //        cc4.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc4);

        //        PdfPCell cc5 = new PdfPCell(new Phrase(x.SDataConferimento, FBody));
        //        cc5.HorizontalAlignment = Element.ALIGN_CENTER;
        //        table2.AddCell(cc5);

        //        PdfPCell cc6 = new PdfPCell(new Phrase("Centro di Raccolta", FBody));
        //        table2.AddCell(cc6);
        //        PdfPCell cc7 = new PdfPCell(new Phrase(x.DesImpianto, FBody));
        //        cc7.Colspan = 2;
        //        table2.AddCell(cc7);

        //        PdfPCell cc61 = new PdfPCell(new Phrase("Sito in", FBody));
        //        table2.AddCell(cc61);
        //        PdfPCell cc71 = new PdfPCell(new Phrase(x.ComuneImpianto, FBody));
        //        cc71.Colspan = 2;
        //        table2.AddCell(cc71);

        //        PdfPCell cc62 = new PdfPCell(new Phrase("Via e Numero Civico", FBody));
        //        table2.AddCell(cc62);
        //        PdfPCell cc72 = new PdfPCell(new Phrase(x.IndirizzoImpianto, FBody));
        //        cc72.Colspan = 2;
        //        table2.AddCell(cc72);

        //        PdfPCell cc63 = new PdfPCell(new Phrase("CAP", FBody));
        //        table2.AddCell(cc63);
        //        PdfPCell cc73 = new PdfPCell(new Phrase(x.CapImpianto, FBody));
        //        cc73.Colspan = 2;
        //        table2.AddCell(cc73);

        //        PdfPCell cc64 = new PdfPCell(new Phrase("Telefono", FBody));
        //        table2.AddCell(cc64);
        //        PdfPCell cc74 = new PdfPCell(new Phrase(x.TelefonoImpianto, FBody));
        //        cc74.Colspan = 2;
        //        table2.AddCell(cc74);

        //        PdfPCell cc65 = new PdfPCell(new Phrase("Fax", FBody));
        //        table2.AddCell(cc65);
        //        PdfPCell cc75 = new PdfPCell(new Phrase(x.FaxImpianto, FBody));
        //        cc75.Colspan = 2;
        //        table2.AddCell(cc75);

        //        document.Add(table2);


        //        Paragraph sp5 = new Paragraph(" ", FBody);
        //        document.Add(sp5);

        //        Paragraph r4 = new Paragraph("Descrizione Tipologia di Rifiuto " + x.DesRifiuto, FBody);
        //        document.Add(r4);
        //        Paragraph r5 = new Paragraph("Codice dell'elenco Rifiuti "+ x.CodRifiuto, FBody);
        //        document.Add(r5);

        //        Paragraph r9 = new Paragraph("Quantitativo avviato al recupero/smaltimento " + x.SQuantita.ToString() + " Unità di misura "+ x.UnitaMisura, FBody);
        //        document.Add(r9);
        //        Paragraph sp8 = new Paragraph(" ", FBody);
        //        document.Add(sp8);
        //        Paragraph sp10 = new Paragraph(" ", FBody);
        //        document.Add(sp10);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
        //        Paragraph r10 = new Paragraph("Firma dell'Addetto al Centro Raccolta", FBody);
        //        r10.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r10);
        //        Paragraph sp9 = new Paragraph(" ", FBody);
        //        document.Add(sp9);




        //        Paragraph r11 = new Paragraph("______________________________________________", FBody);
        //        r11.Alignment = Element.ALIGN_CENTER;
        //        document.Add(r11);


        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampaPre(Document document, CompEventArgs e)
        //{
        //    CompostiereEntity x = e.entity;

        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("Domanda di Assegnazione in comodato gratuito di compostiere domestiche", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
                

        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
        //        document.Add(new Paragraph(" "));
        //        Paragraph l0 = new Paragraph("Generalità del richiedente", FBodyBold);
        //        document.Add(l0);
        //        Paragraph l1 = new Paragraph("Cognome/Nome " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l2 = new Paragraph("Luogo di nascita (comune o stato estero) " + x.LuogoNascita + " Provincia " + x.ProvNascita + " il " + x.DataNascita, FBody);
        //        document.Add(l2);
        //         Paragraph l21 = new Paragraph("Sesso " + x.Sesso + " Codice Fiscale "+ x.Cdf, FBody);
        //         document.Add(l21);
        //         Paragraph l22 = new Paragraph("N° Componenti Famiglia e/o coabitanti " + x.ComponentiFamiglia + " Codice Utenza " + e.entity.CodiceTia , FBody);
        //         document.Add(l22);
        //         Paragraph l23 = new Paragraph("Telefono " + x.Telefono + " Cellulare " + x.Cellulare + " email " + x.Email, FBody);
        //         document.Add(l23);
        //        Paragraph l3 = new Paragraph("Residente in " + x.IndirizzoResidenza + " n. " + x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Comune di " + x.LuogoResidenza + " CAP " + x.CapResidenza +" Provincia "+ x.ProvResidenza  , FBody);
        //        document.Add(l4);
               
        //        Paragraph title1 = new Paragraph("DICHIARA", FTitolo);
        //        title1.SetAlignment("center");
        //        document.Add(title1);
        //        Paragraph sp16 = new Paragraph(" ", FBody);
        //        document.Add(sp16);

        //        Paragraph l7 = new Paragraph("[ ] Di avere un giardino/orto " + x.GrandezzaGiardino, FBody);
        //        document.Add(l7);
        //        Paragraph l8 = new Paragraph("[ ] Di essere residente nel Comune di Terni", FBody);
        //        document.Add(l8);
        //        Paragraph sp14 = new Paragraph(" ", FBody);
        //        document.Add(sp14);
               
        //        Paragraph title2 = new Paragraph("Si Impegna", FTitolo);
        //        title2.SetAlignment("center");
        //        document.Add(title2);
        //        Paragraph sp21 = new Paragraph(" ", FBody);
        //        document.Add(sp21);

        //        Paragraph l222 = new Paragraph("[ ] ad utilizzare in modo corretto le compostiere;", FBody);
        //        document.Add(l222);
        //        Paragraph l233 = new Paragraph("[ ] a collocare la compostiera a una distanza di almeno 3 metri dal confine di proprietà (per distanze inferiori è necessario l'assenso del confinante;", FBody);
        //        document.Add(l233);
        //        Paragraph l231 = new Paragraph("[ ] a restituitre la compostiera ad ASM S.p.A., qualora venisse accertato il mancato o non corretto utilizzo della compostiera;", FBody);
        //        document.Add(l231);
        //        Paragraph sp24 = new Paragraph("[ ] a garantire l'accesso al sito dove verrà ubicata la compostiera al personale incaricato per verificare il corretto uso della compostiera. ", FBody);
        //        document.Add(sp24);
        //        Paragraph sp25 = new Paragraph(" ", FBody);
        //        document.Add(sp25);
        //        Paragraph sp26 = new Paragraph("Il sottoscritto dichiara di aver letto e di approvare le condizioni e le modalità da rispettare per un corretto svolgimento delle attività di compostaggio domestico attraverso il sistema della compostiera.", FBody);
        //        document.Add(sp26);
        //        Paragraph sp251 = new Paragraph(" ", FBody);
        //        document.Add(sp251);
        //        Paragraph sp2813 = new Paragraph(" ", FBody);
        //        document.Add(sp2813);
        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 35; width1[1] = 50; width1[2] = 35;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell(new Phrase("Data " + x.SDataPrenotazione, FBodyBold));
        //        c.HorizontalAlignment = 1;
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("Firma .......................", FBodyBold));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);

        //        document.Add(table1);
               
        //        Paragraph sp260 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp260);
        //        Paragraph sp261 = new Paragraph(" ", FBody);
        //        document.Add(sp261);

        //        Paragraph sp27 = new Paragraph("INFORMATIVA", FBodyBold);
        //        document.Add(sp27);
        //        Paragraph sp28 = new Paragraph("Ai sensi dell'art. 13 D.Lgs 193/03 'Codice in materia di prenotazione dei dati personali', l'uffioc ASM responsabile del trattamento dei dati personali raccolti, ed a Lei inerenti, la informa che i dati da Lei forniti saranno utilizzati per elaborazione (cartacea e/o informatica), al fine di poter erogare quanto da Lei richiesto.", FBody);
        //        document.Add(sp28);
        //        Paragraph sp281 = new Paragraph(" ", FBody);
        //        document.Add(sp281);
        //        Paragraph sp2812 = new Paragraph(" ", FBody);
        //        document.Add(sp2812);
                
        //        PdfPTable table2 = new PdfPTable(3);
               
                
        //        table2.SetWidths(width1);
        //        table2.WidthPercentage = 100f;

        //        PdfPCell c11 = new PdfPCell();
        //        c11.HorizontalAlignment = 1;
        //        c11.BorderWidth = 0f;
        //        table2.AddCell(c11);

        //        PdfPCell c12 = new PdfPCell();
        //        c12.BorderWidth = 0f;
        //        table2.AddCell(c12);


        //        PdfPCell c21 = new PdfPCell(new Phrase("Firma .......................", FBodyBold));
        //        c21.HorizontalAlignment = 1;
        //        c21.BorderWidth = 0f;
        //        table2.AddCell(c21);

        //        document.Add(table2);
              
        //        Paragraph sp2601 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp2601);
        //        Paragraph sp2611 = new Paragraph(" ", FBody);
        //        document.Add(sp2611);

        //        Paragraph sp29 = new Paragraph("Il/La sottoscritto/a è consapevole delle responsabilità e delle sanzioni penali stabilite dalla legge per le false attestazioni e le dichiarazioni mendaci (art. 76 DPR 445/2000)", FBody);
        //        document.Add(sp29);
        //        Paragraph sp30 = new Paragraph("Estremi documento del dichiarante: "+ x.TipoDocumento + " N." + x.NumeroDocumento, FBody);
        //        document.Add(sp30);
                
        //        Paragraph sp25911 = new Paragraph(" ", FBody);
        //        document.Add(sp25911);
                
        //        PdfPTable table111 = new PdfPTable(3);

        //        table111.SetWidths(width1);
        //        table111.WidthPercentage = 100f;

        //        PdfPCell c111 = new PdfPCell(new Phrase("Firma del dichiarante", FBodyBold));
        //        c111.HorizontalAlignment = 1;
        //        c111.BorderWidth = 0f;
        //        table111.AddCell(c111);

        //        PdfPCell c1222 = new PdfPCell();
        //        c1222.BorderWidth = 0f;
        //        table111.AddCell(c1222);


        //        PdfPCell c2222 = new PdfPCell(new Phrase("Firma dell'operatore", FBodyBold));
        //        c2222.HorizontalAlignment = 1;
        //        c2222.BorderWidth = 0f;
        //        table111.AddCell(c2222);

        //        PdfPCell c41 = new PdfPCell(new Phrase(" "));
        //        c41.BorderWidth = 0f;
        //        table111.AddCell(c41);
        //        PdfPCell c42 = new PdfPCell(new Phrase(" "));
        //        c42.BorderWidth = 0f;
        //        table111.AddCell(c42);
        //        PdfPCell c43 = new PdfPCell(new Phrase(" "));
        //        c43.BorderWidth = 0f;
        //        table111.AddCell(c43);




        //        PdfPCell c3 = new PdfPCell(new Phrase("______________________", FBody));
        //        c3.HorizontalAlignment = 1;
        //        c3.BorderWidth = 0f;

        //        table111.AddCell(c3);

        //        PdfPCell c4 = new PdfPCell();
        //        c4.BorderWidth = 0f;
        //        table111.AddCell(c4);


        //        PdfPCell c5 = new PdfPCell(new Phrase("_______________________", FBody));
        //        c5.HorizontalAlignment = 1;
        //        c5.BorderWidth = 0f;

        //        table111.AddCell(c5);
        //        document.Add(table111);
        //        Paragraph sp252 = new Paragraph(" ", FBody);
        //        document.Add(sp252);
        //        Paragraph sp253 = new Paragraph("Codice operatore " + x.NomeUtente, FBodyBold);
        //        document.Add(sp253);

        //        Paragraph sp31 = new Paragraph(" ",FBody);
        //        document.Add(sp31);
        //        Paragraph sp32 = new Paragraph("Note:", FBodyBold);
        //        document.Add(sp32);
        //         Paragraph sp33 = new Paragraph("Il richiedente sarà contattato telefonicamente (il numero di telefono va indicato nei dati anagrafici dell'utente) e riceverà gratuitatemnte l'attrezzatura (compostiera) e le specifiche istruzioni per eseguire la pratica del compostaggio domestico. ", FBody);
        //        document.Add(sp33);
        //         Paragraph sp34 = new Paragraph(" ",FBody);
        //        document.Add(sp34);
        //           Paragraph sp35 = new Paragraph("Annotazioni: " + x.AnnotazioniPrenotazione, FBody);
        //        document.Add(sp34);
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampaCons(Document document, CompEventArgs e)
        //{
        //    CompostiereEntity x = e.entity;

        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("Consegna in comodato gratuito di compostiere domestiche", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
               

        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
               
        //        Paragraph l00 = new Paragraph("Data Consegna " + x.SDataConsegna, FBodyBold);
        //        document.Add(l00);
        //        Paragraph l000 = new Paragraph(" ", FBodyBold);
        //        document.Add(l000);
        //        Paragraph l0 = new Paragraph("Generalità del richiedente", FBodyBold);
        //        document.Add(l0);
        //        Paragraph l1 = new Paragraph("Cognome/Nome " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l2 = new Paragraph("Luogo di nascita (comune o stato estero) " + x.LuogoNascita + " Provincia " + x.ProvNascita + " il " + x.DataNascita, FBody);
        //        document.Add(l2);
        //        Paragraph l21 = new Paragraph("Sesso " + x.Sesso + " Codice Fiscale " + x.Cdf, FBody);
        //        document.Add(l21);
        //        Paragraph l22 = new Paragraph("N° Componenti Famiglia e/o coabitanti " + x.ComponentiFamiglia + " Codice Utenza " + e.entity.CodiceTia, FBody);
        //        document.Add(l22);
        //        Paragraph l23 = new Paragraph("Telefono " + x.Telefono + " Cellulare " + x.Cellulare + " email " + x.Email, FBody);
        //        document.Add(l23);
        //        Paragraph l3 = new Paragraph("Residente in " + x.IndirizzoResidenza + " n. " + x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Comune di " + x.LuogoResidenza + " CAP " + x.CapResidenza + " Provincia " + x.ProvResidenza, FBody);
        //        document.Add(l4);

        //        Paragraph title1 = new Paragraph("DICHIARA:", FTitolo);
        //        title1.SetAlignment("center");
        //        document.Add(title1);
        //        Paragraph sp16 = new Paragraph(" ", FBody);
        //        document.Add(sp16);

        //        Paragraph l7 = new Paragraph("[ ] Di ricevere " + x.Quantita + " compostiere", FBody);
        //        document.Add(l7);
        //        Paragraph l8 = new Paragraph("[ ] Di ricevere le specifiche istruzioni per eseguire la pratica del compostaggio domestico", FBody);
        //        document.Add(l8);
        //        Paragraph sp14 = new Paragraph(" ", FBody);
        //        document.Add(sp14);
        //        Paragraph sp15 = new Paragraph(" ", FBody);
        //        document.Add(sp15);

        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 35; width1[1] = 50; width1[2] = 35;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell(new Phrase("Firma del dichiarante", FBodyBold));
        //        c.HorizontalAlignment = 1;
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("Firma dell'operatore", FBodyBold));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);

        //        PdfPCell c41 = new PdfPCell(new Phrase(" "));
        //        c41.BorderWidth = 0f;
        //        table1.AddCell(c41);
        //        PdfPCell c42 = new PdfPCell(new Phrase(" "));
        //        c42.BorderWidth = 0f;
        //        table1.AddCell(c42);
        //        PdfPCell c43 = new PdfPCell(new Phrase(" "));
        //        c43.BorderWidth = 0f;
        //        table1.AddCell(c43);




        //        PdfPCell c3 = new PdfPCell(new Phrase("______________________", FBody));
        //        c3.HorizontalAlignment = 1;
        //        c3.BorderWidth = 0f;

        //        table1.AddCell(c3);

        //        PdfPCell c4 = new PdfPCell();
        //        c4.BorderWidth = 0f;
        //        table1.AddCell(c4);


        //        PdfPCell c5 = new PdfPCell(new Phrase("_______________________", FBody));
        //        c5.HorizontalAlignment = 1;
        //        c5.BorderWidth = 0f;

        //        table1.AddCell(c5);
        //        document.Add(table1);
        //        Paragraph sp251 = new Paragraph(" ", FBody);
        //        document.Add(sp251);
        //        Paragraph sp252 = new Paragraph(" ", FBody);
        //        document.Add(sp252);
        //        Paragraph sp253 = new Paragraph("Codice operatore " + x.NomeUtente, FBodyBold);
        //        document.Add(sp253);
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampaRic(Document document, CompEventArgs e)
        //{
        //    CompostiereEntity x = e.entity;

        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("Dati anagrafici utente", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph(" ", FBody);
        //        document.Add(sp11);
        //        Paragraph sp12 = new Paragraph(" ", FBody);
        //        document.Add(sp12);

        //        //---------------------intestazione----------------//
        //        Paragraph l00 = new Paragraph("Data Consegna " + x.SDataConsegna, FBodyBold);
        //        document.Add(l00);
        //        Paragraph l000 = new Paragraph(" ", FBodyBold);
        //        document.Add(l000);
        //        Paragraph l0 = new Paragraph("Generalità del richiedente", FBodyBold);
        //        document.Add(l0);
        //        Paragraph l1 = new Paragraph("Cognome/Nome " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l2 = new Paragraph("Luogo di nascita (comune o stato estero) " + x.LuogoNascita + " Provincia " + x.ProvNascita + " il " + x.DataNascita, FBody);
        //        document.Add(l2);
        //        Paragraph l21 = new Paragraph("Sesso " + x.Sesso + " Codice Fiscale " + x.Cdf, FBody);
        //        document.Add(l21);
        //        Paragraph l22 = new Paragraph("N° Componenti Famiglia e/o coabitanti " + x.ComponentiFamiglia + " Codice Utenza " + x.CodiceTia, FBody);
        //        document.Add(l22);
        //        Paragraph l23 = new Paragraph("Telefono " + x.Telefono + " Cellulare " + x.Cellulare + " email " + x.Email, FBody);
        //        document.Add(l23);
        //        Paragraph l3 = new Paragraph("Residente in " + x.IndirizzoResidenza + " n. " + x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Comune di " + x.LuogoResidenza + " CAP " + x.CapResidenza + " Provincia " + x.ProvResidenza, FBody);
        //        document.Add(l4);
        //        Paragraph sp161 = new Paragraph(" ", FBody);
        //        document.Add(sp161);
        //        Paragraph title1 = new Paragraph("DICHIARAZIONE DI AVVENUTA ATTIVITA' DI COMPOSTAGGIO DOMESTICO", FBodyBold);
        //        title1.SetAlignment("center");
        //        document.Add(title1);
        //        Paragraph sp16 = new Paragraph(" ", FBody);
        //        document.Add(sp16);

        //        Paragraph l7 = new Paragraph("Il sottoscritto dichiara di aver praticato il compostaggio domestico per l'anno 2009 secondo quanto stabilito dalle istruzioni in mio possesso ricevute in occasione della consegna della compostiera.", FBody);
        //        document.Add(l7);
        //        Paragraph l8 = new Paragraph(" ", FBody);
        //        document.Add(l8);
        //        Paragraph sp14 = new Paragraph("Prendo atto che in caso di verifica dell'inesistenza delle condizioni necessarie per beneficiare dell'agevolazione, la riduzione della tariffa verrà recuperata e rivalutata dell'interesse legale. ", FBody);
        //        document.Add(sp14);
        //        Paragraph sp15 = new Paragraph(" ", FBody);
        //        document.Add(sp15);
        //        Paragraph title2 = new Paragraph(" ", FBody);
        //        Paragraph sp21 = new Paragraph(" ", FBody);
        //        document.Add(sp21);

        //        Paragraph l222 = new Paragraph("Nota: L'agevolazione sulla tariffa verrà concessa a condizione che il richiedente presenti ad A.S.M. Terni S.p.A. la presente dichiarazione sull'avvenuta pratica del compostaggio domestico svolta nel periodo 01 Gennaio 31 Gennaio 2009", FBodyBold);
        //        document.Add(l222);
                
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampaPreIngo(Document document, AcqEventArgs e)
        //{
        //    ConfAziendaEntity x = e.entity;
        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("SCHEDA RACCOLTA DOMICILIARE RIFIUTI INGOMBRANTI", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph("(A cura ONVS) ", FBodyBold);
        //        sp11.SetAlignment("center");
        //        document.Add(sp11);
        //        Paragraph sp12 = new Paragraph(" ", FBody);
        //        document.Add(sp12);
        //        document.Add(sp12);

        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
        //        document.Add(new Paragraph(" "));

        //        Paragraph l0 = new Paragraph("Data " + x.DomDataPrenotazione + "       Cod.Utenza T.I.A. " + x.CodiceTia, FBody);
        //        document.Add(l0);
        //        Paragraph l1 = new Paragraph("Il Richiedente " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l3 = new Paragraph("Residente in " + x.LuogoResidenza + " Strada/Piazza " + x.IndirizzoResidenza + " n. " + x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Telefono " + x.TelefonoResidenza , FBody);
        //        document.Add(l4);
        //        Paragraph l5 = new Paragraph("Ritiro programmato per il " + x.SDataConferimento, FBody);
        //        document.Add(l5);
        //        Paragraph l6 = new Paragraph(" ", FBody);
        //        document.Add(l6);
        //        Paragraph sp13 = new Paragraph(" ", FBody);
        //        document.Add(sp13);
        //        document.Add(sp13);

        //        Paragraph title1 = new Paragraph("Tipologia Rifiuti", FTitolo);
        //        title1.SetAlignment("center");
        //        document.Add(title1);
        //        Paragraph sp16 = new Paragraph(" ", FBody);
        //        document.Add(sp16);
               
        //        PdfPTable table = new PdfPTable(2);
        //        int[] width = new int[2];
        //        width[0] = 20; width[1] = 80;
        //        table.SetWidths(width);
        //        table.WidthPercentage = 100f;
        //        table.AddCell(new Phrase("Quantità", FBodyBold));
        //        table.AddCell(new Phrase("Descrizione dell'oggetto", FBodyBold));

        //        table.AddCell(new Phrase(x.UnitaMisura + " " + x.SQuantita, FBody));
        //        if (x.DescrizioneRifiuto != null && x.DescrizioneRifiuto.Length > 0)
        //            table.AddCell(new Phrase(x.DesRifiuto + " - " + x.DescrizioneRifiuto, FBody));
        //        else
        //            table.AddCell(new Phrase(x.DesRifiuto, FBody));
        //        if (x.DesRifiuto1.Trim().Length == 0)
        //        {
        //            table.AddCell(" ");
        //            table.AddCell(" ");
        //        }
        //        else
        //        {
        //            table.AddCell(new Phrase(x.UnitaMisura1 + " " + x.SQuantita1, FBody));
        //            if (x.DescrizioneRifiuto1 != null && x.DescrizioneRifiuto1.Length > 0)
        //                table.AddCell(new Phrase(x.DesRifiuto1 + " - " + x.DescrizioneRifiuto1, FBody));
        //            else
        //                table.AddCell(new Phrase(x.DesRifiuto1, FBody));
        //        }

        //        if (x.DesRifiuto2.Trim().Length == 0)
        //        {
        //            table.AddCell(" ");
        //            table.AddCell(" ");
        //        }
        //        else
        //        {
        //            table.AddCell(new Phrase(x.UnitaMisura2 + " " + x.SQuantita2, FBody));
        //            if (x.DescrizioneRifiuto2 != null && x.DescrizioneRifiuto2.Length > 0)
        //                table.AddCell(new Phrase(x.DesRifiuto2 + " - " + x.DescrizioneRifiuto2, FBody));
        //            else
        //                table.AddCell(new Phrase(x.DesRifiuto2, FBody));
        //        }

        //        if (x.DesRifiuto3.Trim().Length == 0)
        //        {
        //            table.AddCell(" ");
        //            table.AddCell(" ");
        //        }
        //        else
        //        {
        //            table.AddCell(new Phrase(x.UnitaMisura3 + " " + x.SQuantita3, FBody));
        //            if (x.DescrizioneRifiuto3 != null && x.DescrizioneRifiuto3.Length > 0)
        //                table.AddCell(new Phrase(x.DesRifiuto3 + " - " + x.DescrizioneRifiuto3, FBody));
        //            else
        //                table.AddCell(new Phrase(x.DesRifiuto3, FBody));
        //        }

        //        document.Add(table);
        //        document.Add(new Paragraph(" "));

        //        Paragraph l00 = new Paragraph("Annotazioni:" + x.DomNote , FBody);
        //        document.Add(l00);
        //        document.Add(new Paragraph(" "));

        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 35; width1[1] = 35; width1[2] = 50;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell();
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("L'Incaricato ___________________________", FBodyBold));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);
        //        document.Add(table1);

        //        document.Add(new Paragraph(" "));
        //        Paragraph sp260 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp260);
        //        document.Add(new Paragraph(" "));
        //        document.Add(new Paragraph("Servizio Evaso    [ ] SI      [ ] NO"));
        //        document.Add(new Paragraph(" "));
        //        document.Add(new Paragraph("Motivo________________________________________________________________________________________", FBody));
        //        document.Add(new Paragraph("_____________________________________________________________________________________________", FBody));
        //        document.Add(new Paragraph(" "));
        //        document.Add(table1);
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        //private bool stampaPreVerde(Document document, AcqEventArgs e)
        //{
        //    ConfAziendaEntity x = e.entity;
        //    bool bRet = false;
        //    Font FTitolo = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD);
        //    Font FBody = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL);
        //    Font FBodyBold = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD);
        //    try
        //    {
        //        document.SetPageSize(PageSize.A4);
        //        document.Open();

        //        string sFilename = @"C:\CentriRaccoltaRes\Logo.jpg";
        //        iTextSharp.text.Image jpg = this.DoGetImageFile(sFilename);
        //        if (jpg != null)
        //        {
        //            jpg.ScalePercent(20f);
        //            document.Add(jpg);
        //        }

        //        Paragraph title = new Paragraph("SCHEDA RACCOLTA DOMICILIARE DEL VERDE", FTitolo);
        //        title.SetAlignment("center");
        //        document.Add(title);
        //        Paragraph sp11 = new Paragraph("(A cura ONVS) ", FBodyBold);
        //        sp11.SetAlignment("center");
        //        document.Add(sp11);
        //        Paragraph sp12 = new Paragraph(" ", FBody);
        //        document.Add(sp12);
        //        document.Add(sp12);

        //        //---------------------intestazione----------------//
        //        document.Add(new Paragraph("Scheda N. " + x.Id, FBodyBold));
        //        document.Add(new Paragraph(" "));

        //        Paragraph l0 = new Paragraph("Data " + x.DomDataPrenotazione + "       Cod.Utenza T.I.A. " + x.CodiceTia, FBody);
        //        document.Add(l0);
        //        Paragraph l1 = new Paragraph("Il Richiedente " + x.Cognome + " " + x.Nome, FBody);
        //        document.Add(l1);
        //        Paragraph l3 = new Paragraph("Residente in " + x.LuogoResidenza + " Strada/Piazza " + x.IndirizzoResidenza + " n. " + x.NumeroCivicoResidenza + x.EsponenteResidenza, FBody);
        //        document.Add(l3);
        //        Paragraph l4 = new Paragraph("Telefono " + x.TelefonoResidenza, FBody);
        //        document.Add(l4);
        //        Paragraph l41 = new Paragraph("Fascine N. " + x.DomFascine.ToString() +" Peso max Kg. 20 Lunghezza max m.1", FBody);
        //        document.Add(l41);
        //        Paragraph l42 = new Paragraph("Sacchi N. " + x.DomSacchi.ToString() +" Peso Max Kg.20", FBody);
        //        document.Add(l42);
        //        Paragraph l43 = new Paragraph("Altro " + x.DomAltro, FBody);
        //        Paragraph l44 = null;
        //        if (x.DomCompostiere.Equals("S"))
        //            l44 = new Paragraph("Fornito di Compostiera SI", FBody);
        //        else
        //        {
        //            l44 = new Paragraph("Fornito di Compostiera NO", FBody);
        //            document.Add(l44);
        //            Paragraph l45 = new Paragraph("Motivo " + x.DomMotivoKo, FBody);
        //            document.Add(l45);
        //        }
                
        //        Paragraph l5= null;
        //        if(x.DomAltriGiri.Equals("S"))
        //        l5 = new Paragraph("Ritiro programmato per il " + x.SDataConferimento + " Necessita di ulteriori giri di raccolta SI", FBody);
        //            else
        //        l5 = new Paragraph("Ritiro programmato per il " + x.SDataConferimento + " Necessita di ulteriori giri di raccolta NO", FBody);
        //        document.Add(l5);
        //        string da;
        //        string a;
        //        if (string.IsNullOrEmpty(x.DomPeriodoDa)) da = "__________"; else da = x.DomPeriodoDa;
        //        if (string.IsNullOrEmpty(x.DomPeriodoA)) a = "__________"; else a = x.DomPeriodoA;
        //        Paragraph l55 = new Paragraph("Periodo dal" + da + "al " + a, FBody);
        //        document.Add(l55);
           
        //        Paragraph l00 = new Paragraph("Annotazioni:" + x.DomNote, FBody);
        //        document.Add(l00);
        //        document.Add(new Paragraph(" "));

        //        PdfPTable table1 = new PdfPTable(3);
        //        int[] width1 = new int[3];
        //        width1[0] = 35; width1[1] = 35; width1[2] = 50;
        //        table1.SetWidths(width1);
        //        table1.WidthPercentage = 100f;

        //        PdfPCell c = new PdfPCell();
        //        c.BorderWidth = 0f;
        //        table1.AddCell(c);

        //        PdfPCell c1 = new PdfPCell();
        //        c1.BorderWidth = 0f;
        //        table1.AddCell(c1);


        //        PdfPCell c2 = new PdfPCell(new Phrase("L'Incaricato ___________________________", FBodyBold));
        //        c2.HorizontalAlignment = 1;
        //        c2.BorderWidth = 0f;
        //        table1.AddCell(c2);
        //        document.Add(table1);

        //        document.Add(new Paragraph(" "));
        //        Paragraph sp260 = new Paragraph("_____________________________________________________________________________________________", FBody);
        //        document.Add(sp260);
        //        document.Add(new Paragraph(" "));
        //        document.Add(new Paragraph("Servizio Evaso    [ ] SI      [ ] NO"));
        //        document.Add(new Paragraph(" "));
        //        document.Add(new Paragraph("Motivo________________________________________________________________________________________", FBody));
        //        document.Add(new Paragraph("_____________________________________________________________________________________________", FBody));
        //        document.Add(new Paragraph(" "));
        //        document.Add(table1);
        //        bRet = true;
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //    finally
        //    {
        //        document.Close();
        //    }
        //    return bRet;
        //}

        
    }
}
